<template>
  <div>
    <el-breadcrumb separator="/">
        <el-breadcrumb-item style="cursor:pointer;" :to="{ path: '/TestRecordData',query:{instanceId: instanceId, testNumber: testNumber, pk_ch_name: pk_ch_name, tplt_name: tplt_name, testDate: testDate,review_status: review_status} }"><span style="cursor:pointer;">返回</span></el-breadcrumb-item>
    </el-breadcrumb>
    <div class="info">
      <el-card class="box-card">
        <div class="header">公共参数</div>
        <el-row>
          <el-col :span="8" style="display: flex">委试号：{{testNumber}}</el-col>
          <el-col :span="8">选择工位：{{station_name}}</el-col>
          <el-col :span="8">试品名称：{{pk_ch_name}}</el-col>
        </el-row>
        <el-row>
          <el-col :span="8">试品模板：{{tplt_name}}</el-col>
          <el-col :span="8">海拔参数m：{{Kam}}</el-col>
          <el-col :span="8">适用海拔（m）：{{seaLevel}}</el-col>
        </el-row>
        <el-row>
          <el-col :span="8">相对湿度(%RH)：{{RH}}</el-col>
          <el-col :span="8">大气压(kPa)：{{ATM}}</el-col>
          <el-col :span="8"> 温度(℃)：{{T}}</el-col>
        </el-row>
        <el-row>
          <el-col :span="8">是否充气：{{ifInflate==='0'?'否':'是'}}</el-col>
          <el-col :span="8">充气类型：{{ifInflate === '0' ? '--' : gasKind }}</el-col>
          <el-col :span="8">充气压力(MPa)：{{ifInflate === '0' ? '--' : setPress}}</el-col>
        </el-row>
        <el-row>
          <el-col :span="16">试验类型：{{testKind}}</el-col>
          <el-col :span="8">试验依据标准：{{standardStr}}</el-col>
        </el-row>
        <div style="margin:20px 0;" class="header">设备参数</div>
        <!-- <div style="border-bottom: 1px solid #E8E8E8;"></div>   -->
        <el-tabs v-model="activeName">
          <el-tab-pane v-for="(item,index) in data" :key="index" :label="item.type" :name="item.type">
            <div v-if="item.type === '雷电冲击耐受电压试验'">
              <el-row style="text-align:center">
              <el-col :span="8">充电时间（s）：{{item.param.chargeTime}}</el-col>
              <el-col :span="8">首次充电电压(kVp)：{{item.param.chargeVolt}}</el-col>
              <el-col :span="8">球隙距离(mm)：{{item.param.ballInterval}}</el-col>
            </el-row>
            <el-row style="text-align:center">
              <el-col :span="8">计数器(次)：{{item.param.chargeCnt}}</el-col>
              <el-col :span="8">连续放电：{{item.param.ifDischarge}}</el-col>
              <el-col :span="8">老练次数：{{item.param.bufferCnt}}</el-col>
            </el-row>
            <el-table :data="item.partParam" stripe border style="width: 100%; margin-top: 20px">
              <el-table-column prop="partName" label="试验部位" align="center">
              </el-table-column>
              <el-table-column prop="originVolt" label="原始电压(kVp)" align="center">
              </el-table-column>
              <el-table-column prop="ifTest" label="是否试验" align="center">
              </el-table-column>
              <el-table-column prop="ifCalair" label="是否校大气" align="center">
              </el-table-column>
              <el-table-column prop="percentVolt" label="试验电压百分比(%)" align="center">
              </el-table-column>
              <el-table-column prop="remark" label="备注" align="center">
                <template slot-scope="scope">
                  <span v-if="scope.row.remark === ''">无</span>
                  <span v-else>{{scope.row.remark}}</span>
                </template>
              </el-table-column>
            </el-table>
            </div>
            <div v-else-if="item.type === '工频耐受电压试验' || item.type === '工频耐受电压试验(湿)'">
            <el-row style="text-align:center">
              <el-col :span="8">采样间隔（s）：{{item.param.collectInterval}}</el-col>
              <el-col :span="8">耐压时间(s)：{{item.param.withstandVoltTime}}</el-col>
              <el-col v-show="item.param.rainElect" :span="8">雨水电导率：{{item.param.rainElect}}</el-col>
            </el-row>
            <el-row style="text-align:center">
              <el-col v-show="item.param.horizCompont" :span="8">水平分量：{{item.param.horizCompont}}</el-col>
              <el-col v-show="item.param.verticalCompont" :span="8">垂直分量：{{item.param.verticalCompont}}</el-col>
              <el-col v-show="item.param.waterTemp" :span="8">水温(℃)：{{item.param.waterTemp}}</el-col>
            </el-row>
            <el-table :data="item.partParam" stripe border style="width: 100%; margin-top: 20px">
              <el-table-column prop="partName" label="试验部位" align="center">
              </el-table-column>
              <el-table-column prop="originVolt" label="原始电压(kVp)" align="center">
              </el-table-column>
              <el-table-column prop="ifTest" label="是否试验" align="center">
              </el-table-column>
              <el-table-column prop="ifCalair" label="是否校大气" align="center">
              </el-table-column>
              <el-table-column prop="percentVolt" label="试验电压百分比(%)" align="center">
              </el-table-column>
              <el-table-column prop="remark" label="备注" align="center">
                <template slot-scope="scope">
                  <span v-if="scope.row.remark === ''">无</span>
                  <span v-else>{{scope.row.remark}}</span>
                </template>
              </el-table-column>
            </el-table>
            </div>
            <div v-else>
            <el-form ref="form" :model="form" label-width="140px">
              <el-row style="text-align:center">
                <el-col :span="8">
                  <el-form-item label="预加电压：">
                    <el-input disabled placeholder="请输入内容" v-model="form.input1" clearable>
                      <template slot="append">kV</template>
                    </el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="预加时间：">
                    <el-input disabled placeholder="请输入内容" v-model="form.input1" clearable>
                      <template slot="append">s</template>
                    </el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="测量电压：">
                    <el-input disabled placeholder="请输入内容" v-model="form.input1" clearable>
                      <template slot="append">kV</template>
                    </el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row style="text-align:center">
                <el-col :span="8">
                  <el-form-item label="测量时间：">
                    <el-input disabled placeholder="请输入内容" v-model="form.input1" clearable>
                      <template slot="append">s</template>
                    </el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label=" 校准源电荷量：">
                    <el-input disabled placeholder="请输入内容" v-model="form.input1" clearable>
                      <template slot="append">pC</template>
                    </el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label=" 标准局放量：">
                    <el-input disabled placeholder="请输入内容" v-model="form.input1" clearable>
                      <template slot="append">pC</template>
                    </el-input>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
            </div>
          </el-tab-pane>
          <!-- <el-tab-pane label="雷电冲击" name="first">
            <el-row style="text-align:center">
              <el-col :span="8">充电时间（s）：25</el-col>
              <el-col :span="8">首次充电电压(kVp)：25</el-col>
              <el-col :span="8">球隙距离(mm)：35</el-col>
            </el-row>
            <el-row style="text-align:center">
              <el-col :span="8">计数器(次)：15</el-col>
              <el-col :span="8">连续放电：是</el-col>
              <el-col :span="8">老练次数：3</el-col>
            </el-row>
            <el-table :data="tableData" stripe border style="width: 100%; margin-top: 20px">
              <el-table-column prop="date" label="试验部位" align="center">
              </el-table-column>
              <el-table-column prop="name" label="原始电压(kVp)" align="center">
              </el-table-column>
              <el-table-column prop="value" label="是否试验" align="center">
              </el-table-column>
              <el-table-column prop="value" label="是否校大气" align="center">
              </el-table-column>
              <el-table-column prop="address" label="试验电压百分比(%)" align="center">
              </el-table-column>
              <el-table-column prop="xq" label="备注" align="center">
                <template slot-scope="scope">
                  <span v-if="scope.row.xq === ''">无</span>
                  <span v-else>{{scope.row.xq}}</span>
                </template>
              </el-table-column>
            </el-table>
          </el-tab-pane>
          <el-tab-pane label="工频" name="second">
            <el-row>
              <el-col :span="8">采样间隔（s）：5</el-col>
              <el-col :span="8">耐压时间(s)：60</el-col>
            </el-row>
            <el-table :data="tableData" stripe border style="width: 100%; margin-top: 20px">
              <el-table-column prop="date" label="试验部位" align="center">
              </el-table-column>
              <el-table-column prop="name" label="原始电压(kVp)" align="center">
              </el-table-column>
              <el-table-column prop="value" label="是否试验" align="center">
              </el-table-column>
              <el-table-column prop="value" label="是否校大气" align="center">
              </el-table-column>
              <el-table-column prop="address" label="试验电压百分比(%)" align="center">
              </el-table-column>
              <el-table-column prop="xq" label="备注" align="center">
                <template slot-scope="scope">
                  <span v-if="scope.row.xq === ''">无</span>
                  <span v-else>{{scope.row.xq}}</span>
                </template>
              </el-table-column>
            </el-table>
          </el-tab-pane>
          <el-tab-pane label="局放" name="third">
            <el-form ref="form" :model="form" label-width="140px">
              <el-row style="text-align:center">
                <el-col :span="8">
                  <el-form-item label="预加电压：">
                    <el-input disabled placeholder="请输入内容" v-model="form.input1">
                      <template slot="append">kV</template>
                    </el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="预加时间：">
                    <el-input disabled placeholder="请输入内容" v-model="form.input1">
                      <template slot="append">s</template>
                    </el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="测量电压：">
                    <el-input disabled placeholder="请输入内容" v-model="form.input1">
                      <template slot="append">kV</template>
                    </el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row style="text-align:center">
                <el-col :span="8">
                  <el-form-item label="测量时间：">
                    <el-input disabled placeholder="请输入内容" v-model="form.input1">
                      <template slot="append">s</template>
                    </el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label=" 校准源电荷量：">
                    <el-input disabled placeholder="请输入内容" v-model="form.input1">
                      <template slot="append">pC</template>
                    </el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label=" 标准局放量：">
                    <el-input disabled placeholder="请输入内容" v-model="form.input1">
                      <template slot="append">pC</template>
                    </el-input>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
          </el-tab-pane> -->
        </el-tabs>
      </el-card>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      instanceId: this.$route.query.instanceId,
      testNumber: this.$route.query.testNumber,
      pk_ch_name: this.$route.query.pk_ch_name,
      tplt_name: this.$route.query.tplt_name,
      testDate: this.testDate,
      review_status: this.$route.query.review_status,
      station_name: '',
      data: null,
      ATM: 0, // 大气压
      RH: 0, // 相对湿度
      T: 0, // 温度
      Kam: 0,
      gasKind: '',
      ifInflate: '',
      seaLevel: '',
      setPress:'',
      standardStr:'',
      testKind:'',
      form: {
        input1: '60'
      },
      activeName: 'first',
      tableData: [{
          date: '断路器',
          name: '158',
          address: '24%',
          value: '否',
          xq: '分闸及对地',
          flag: false,
          sure: false
        }, {
          date: '电阻器',
          name: '134',
          address: '58%',
          value: '是',
          xq: '端口电压',
          flag: false,
          sure: false
        }, {
          date: '相间及对地电压',
          name: '167',
          address: '100%',
          value: '否',
          xq: '',
          flag: false,
          sure: false
        }, {
          date: '活门',
          name: '124',
          address: '30%',
          value: '是',
          xq: '',
          flag: false,
          sure: false
        }]
    }
  },
  methods: {
    async getTestAllParam() {
      const { result } = await this.$http.get(`/testRecordData/getTestAllParam?instanceId=${this.instanceId}&testNumber=${this.testNumber}`)
      this.ATM = result.ATM
      this.Kam = result.Kam
      this.RH = result.RH
      this.T = result.T
      this.gasKind = result.gasKind
      this.ifInflate = result.ifInflate
      this.seaLevel = result.seaLevel
      this.setPress = result.setPress
      this.standardStr = result.standardStr
      this.station_name = result.stationName
      this.testKind = result.testKind
      this.testNumber = result.testNumber
    },
    async getTestEquipParam() {
      const { result } = await this.$http.get(`/testRecordData/getTestEquipParam?instanceId=${this.instanceId}`)
      // console.log(result);
      this.data = result
      this.activeName = result[0].type
    }
  },
  created() {
    //获得试验的全部参数
    this.getTestAllParam()
    this.getTestEquipParam()
  }
}
</script>

<style lang="scss" scoped>
@import "./ShowAllParameters.scss";
</style>